package alp.starcode.nudtportal.framework.mybatis.entity;

import alp.starcode.nudtportal.framework.constant.ElasticConst;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

/**
 * <p>
 * log_user_login（用户登录日志表）
 * </p>
 *
 * @author xwx
 * @since 2023-08-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("log_user_login")
@ApiModel(value = "LogUserLogin对象", description = "log_user_login（用户登录日志表）")
@NoArgsConstructor
@Document(indexName = ElasticConst.LOG_USER_LOGIN)
public class LogUserLogin extends Model<LogUserLogin> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "登录流水号")
    @TableId("login_id")
    @Id
    private String loginId;

    @ApiModelProperty(value = "用户流水号")
    @TableField("user_id")
    @Field(type = FieldType.Keyword)
    private String userId;

    @ApiModelProperty(value = "一卡通卡号")
    @TableField("campus_number")
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String campusNumber;

    @ApiModelProperty(value = "登录账号")
    @TableField("login_name")
    @Field(type = FieldType.Keyword)
    private String loginName;

    @ApiModelProperty(value = "登录时间")
    @TableField("login_time")
    @Field(type = FieldType.Long)
    private Long loginTime;

    @ApiModelProperty(value = "登录地址")
    @TableField("login_address")
    @Field(type = FieldType.Text)
    private String loginAddress;

    @ApiModelProperty(value = "浏览器类型")
    @TableField("browser_type")
    @Field(type = FieldType.Text)
    private String browserType;

    @ApiModelProperty(value = "是否登录成功")
    @TableField("login_success")
    @Field(type = FieldType.Keyword)
    private Integer LoginSuccess;

    @ApiModelProperty(value = "创建时间")
    @TableField("create_time")
    @Field(type = FieldType.Long)
    private Long createTime;

    @ApiModelProperty(value = "修改时间")
    @TableField("update_time")
    @Field(type = FieldType.Long)
    private Long updateTime;


    @Override
    protected Serializable pkVal() {
        return this.loginId;
    }

}
